viewport: share style context with pixelcache
authorChristian Hergert <christian@hergert.me>
Tue, 8 Sep 2015 22:09:04 +0000 (15:09 -0700)
committerChristian Hergert <christian@hergert.me>
Sun, 13 Sep 2015 20:41:19 +0000 (13:41 -0700)
This allows the pixel cache to opportunistically use CAIRO_CONTENT_COLOR
instead of CAIRO_CONTENT_COLOR_ALPHA during surface creation.

https://bugzilla.gnome.org/show_bug.cgi?id=754658

gtk/gtkviewport.c

index 6b842b4f88acda8a139382c03fd2929dedc078ee..9b966052a615e4b786bffd9255cf90c99900ae84 100644 (file)
@@ -260,6 +260,7 @@ static void
 gtk_viewport_init (GtkViewport *viewport)
 {
   GtkViewportPrivate *priv;
+  GtkStyleContext *style_context;
 
   viewport->priv = gtk_viewport_get_instance_private (viewport);
   priv = viewport->priv;
@@ -276,6 +277,9 @@ gtk_viewport_init (GtkViewport *viewport)
 
   priv->pixel_cache = _gtk_pixel_cache_new ();
 
+  style_context = gtk_widget_get_style_context (GTK_WIDGET (viewport));
+  _gtk_pixel_cache_set_style_context (priv->pixel_cache, style_context);
+
   gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (viewport)), GTK_STYLE_CLASS_FRAME);
   viewport_set_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL, NULL);
   viewport_set_adjustment (viewport, GTK_ORIENTATION_VERTICAL, NULL);